<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 利用函数计算1~100之间的累加和 -->
    <script>
        function getSum(star, end) {
            var sum = 0;
            for (var i = star; i <= end; i++) {
                sum += i;
            }
            console.log(sum);
        }
        getSum(1, 100);
    </script>
</head>

<body>

</body>

</html>